<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@include file="../header.jsp" %>
<script>
	$(function(){
		bindProvider();
		bindEvent()
		
	})
	
	//绑定供应商下拉列表
	function bindProvider(){
		$.post("listProvider",function(msg){
			var str = "";
			var selectid = $("#selectid").val();
			$(msg).each(function(i){
				var p = msg[i]
				if(selectid == p.id){
					str += "<option value='"+p.id+"' selected='selected'>"
				}else{
					str += "<option value='"+p.id+"'>"
				}
				str += p.proname
				str += "</option>"
			})
			$("#providerId").append(str)
		},"json")
	}
	
	function bindEvent(){
		$("#save").click(function(){
			document.forms[0].submit();
		})
	}
</script>
<div class="right">
        <div class="location">
            <strong>你现在所在的位置是:</strong>
            <span>订单管理页面 >> 订单添加页面</span>
        </div>
        <div class="providerAdd">
          <form id="billForm" name="billForm" method="post" action="updateBill">
				<input type="hidden" value="${requestScope.bill.id }" name="id">
                <!--div的class 为error是验证错误，ok是验证成功-->
                <div class="">
                    <label for="billCode">订单编码：</label>
                    <input type="text" name="billcode" id="billcode" value="${requestScope.bill.billcode }" readonly="readonly"> 
                </div>
                <div>
                    <label for="productName">商品名称：</label>
                    <input type="text" name="productname" id="productname" value="${requestScope.bill.productname }"> 
					<font color="red"></font>
                </div>
                <div>
                    <label for="productUnit">商品单价：</label>
                    <input type="text" name="productunit" id="productunit" value="${requestScope.bill.productunit }"> 
					<font color="red"></font>
                </div>
                <div>
                    <label for="productCount">商品数量：</label>
                    <input type="text" name="productcount" id="productcount" value="${requestScope.bill.productcount }"> 
					<font color="red"></font>
                </div>
                <div>
                    <label for="totalPrice">总金额：</label>
                    <input type="text" name="totalprice" id="totalprice" value="${requestScope.bill.totalprice }"> 
					<font color="red"></font>
                </div>
                <div>
                    <label for="providerId">供应商：</label>
                  <input type="hidden" value="${requestScope.bill.provider.id }" id="selectid">
					<select name="provider.id" id="providerId">
		        	</select>
					<font color="red"></font>
                </div>
                <div>
                    <label >是否付款：</label>
                		
						<input type="radio" name="ispayment" value="0" <c:if test="${requestScope.bill.ispayment==0 }">checked="checked"</c:if>>未付款
						<input type="radio" name="ispayment" value="1" <c:if test="${requestScope.bill.ispayment==1 }">checked="checked"</c:if>>已付款
					
					
                </div>
                <div class="providerAddBtn">
                  <input type="button" name="save" id="save" value="保存">
				  <input type="button" id="back" name="back" value="返回" >
              	</div>
            </form>
        </div>

    </div>
</section>

<%@include file="../foot.jsp"%>